(function ($) {
	Drupal.behaviors.detail_realestate = {
		attach: function(context, settings) { 		
            $(".photo_player_thumbnails li a").click(function() {				
                $('.photo_player_current_item img').attr('src', $(this).attr('ref'));	
                $('.photo_player_thumbnails li a img').removeClass('photo_player_thumbnail_current');
                $(this).children('img').addClass('photo_player_thumbnail_current');                
            });                        
        }
   };
}(jQuery));


var zoom = 16;
var map;
function detailInitialize() {
    centerLatitude =  jQuery('.txt_product_real_latitude').val();
    centerLongitude = jQuery('.txt_product_real_longitude').val();
	var myLatLng = new google.maps.LatLng(centerLatitude , centerLongitude);
	var mapOptions = {
		zoom: zoom,
		scrollwheel: false,
		center: myLatLng ,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	map = new google.maps.Map(document.getElementById('map_product'), mapOptions);	
	infowindow = new google.maps.InfoWindow();
	
    var marker =  new google.maps.Marker({
		position: new google.maps.LatLng(centerLatitude , centerLongitude),
		//icon: image, 
	    clickable: true ,
		map: map
	});
	marker.info = new google.maps.InfoWindow({
	  content: jQuery('.txt_product_real_address').val(),
	});
	marker.info.open(map, marker);		
	google.maps.event.addListener(marker, 'click', function() {
		marker.info.open(map, marker);		
	});
	
}



function addMarker(latitude , longitude , description){
	var marker = new GMarker( new GLatLng( latitude , longitude ));
	GEvent.addListener(marker , 'click' , function (){
		marker.openInfoWindowHtml(description);
	});
	map.addOverlay(marker);
}
window.onload = detailInitialize;


